public class QueryRoomInfoServlet extends HttpServlet{
	private BllFactory bllFactory = BllFactory.getBllFactory();

	@SuppressWarnings("null")
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		resp.setCharacterEncoding("utf-8");
		resp.setContentType("text/html;charset = utf-8");
		
		int type = Integer.parseInt(req.getParameter("type"));
		int roomid = Integer.parseInt(req.getParameter("content"));
		System.out.println(roomid);
		BLLRoom bllRoom = bllFactory.getInstance(BLLRoom.class);
		if(type == 1){
			List<Room> list = bllRoom.queryRoomInfo();
			JSONArray json = JSONArray.fromObject(list);
			PrintWriter pw = resp.getWriter();
			pw.print(json);
			pw.close();
		}else {
			List<Room> room = bllRoom.queryRoomInfo(roomid);
			JSONArray json = JSONArray.fromObject(room);		
			PrintWriter pw = resp.getWriter();
			pw.print(json);
			pw.close();
		}
	}
	
	
}